PROJECT = "LuatOS-SoC-Test"
VERSION = "1.0.0"
--默认的log全部不输出
log.setLevel("WARN")

sys = require"sys"

--全局接口
port = {}
--需要测试的模块
local modules = {
    "uartTest",
    "cryptoTest",
    "fdbTest",
    "jsonTest",
    "ioTest",
    "zbuffTest",
    "pwmTest",
    "i2cTest",
    "ds18b20Test",
    "spiTest",
    "sfudTest",
}

sys.taskInit(function()
    local failed = {}--没跑过的项目
    for _,j in pairs(modules) do
        print("[TEST]"..j)
        waitFor = nil
        local r,e = pcall(function()
            require(j)
        end)
        if waitFor then--等等
            local ww,wr = sys.waitUntil(waitFor,60*1000)
            r = ww and wr
            waitFor = nil
        end
        if r then
            print("[PASS]"..j)
        else
            print("[NOT PASS]"..j)
            print(e)
            table.insert(failed,j)
        end
    end
    --测试跑完了
    while 1 do
        if #failed == 0 then
            print("[DONE]")
        else
            print("[FAIL]"..table.concat(failed,","))
        end
        sys.wait(10000)
    end
end)



sys.run()
